import {
	BASE_URL
} from "@/utils/http"
export default function useUploadFile() {
	const uploadFile = (filePath) => {
		return new Promise((resolve, reject) => {
			uni.uploadFile({
				url: BASE_URL + '/auth/common/upload',
				filePath,
				name: 'file',
				header: {
					"Authorization": uni.getStorageSync('token')
				},
				success: (res) => {
					resolve(JSON.parse(res.data))
				},
				fail: (err) => {
					reject(err)
				}
			})
		})
	}
	return {
		uploadFile
	};
}